<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box">
        <ul class="list">
            <!-- :key 表示唯一标识 -->
            <li v-for="item,index in list" :key="index">{{item}}</li>
        </ul>
        <button @click="fn">走一走</button>
    </div>

    <script src="./vue.js"></script>
    <script>
        const app = new Vue({
            // 存放挂载的对象
            el: '#box',
            // 存放数据
            data: {
                id: 1,
                list: ['帅哥', '美女', '程序员']
            },
            methods: {
                fn: function () {
                    console.log(111);

                    // 移除第一个元素
                    const first = this.list.shift();
                    //将移除的元素添加到数组的最后
                    this.list.push(first);
                }
            }
        })
    </script>
</body>

</html>